package com.ruoyi.business.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.business.domain.BusinessInfo;
import com.ruoyi.business.mapper.BusinessInfoMapper;
import com.ruoyi.business.service.IBusinessInfoService;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;

/**
 * 业务信息 服务层实现
 * 
 * @author ruoyi
 */
@Service
public class BusinessInfoServiceImpl implements IBusinessInfoService
{
    @Autowired
    private BusinessInfoMapper businessInfoMapper;

    /**
     * 查询业务信息
     * 
     * @param businessId 业务ID
     * @return 业务信息
     */
    @Override
    public BusinessInfo selectBusinessInfoById(Long businessId)
    {
        return businessInfoMapper.selectBusinessInfoById(businessId);
    }

    /**
     * 查询业务信息列表
     * 
     * @param businessInfo 业务信息
     * @return 业务信息集合
     */
    @Override
    public List<BusinessInfo> selectBusinessInfoList(BusinessInfo businessInfo)
    {
        return businessInfoMapper.selectBusinessInfoList(businessInfo);
    }
    
    /**
     * 查询即将到期的业务列表
     * 
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return 业务信息集合
     */
    @Override
    public List<BusinessInfo> selectExpiringBusinessList(Date startDate, Date endDate)
    {
        return businessInfoMapper.selectExpiringBusinessList(startDate, endDate);
    }

    /**
     * 新增业务信息
     * 
     * @param businessInfo 业务信息
     * @return 结果
     */
    @Override
    public int insertBusinessInfo(BusinessInfo businessInfo)
    {
        businessInfo.setCreateTime(DateUtils.getNowDate());
        return businessInfoMapper.insertBusinessInfo(businessInfo);
    }

    /**
     * 修改业务信息
     * 
     * @param businessInfo 业务信息
     * @return 结果
     */
    @Override
    public int updateBusinessInfo(BusinessInfo businessInfo)
    {
        businessInfo.setUpdateTime(DateUtils.getNowDate());
        return businessInfoMapper.updateBusinessInfo(businessInfo);
    }

    /**
     * 删除业务信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBusinessInfoByIds(String ids)
    {
        return businessInfoMapper.deleteBusinessInfoByIds(Convert.toStrArray(ids));
    }
    
    /**
     * 删除业务信息信息
     * 
     * @param businessId 业务ID
     * @return 结果
     */
    @Override
    public int deleteBusinessInfoById(Long businessId)
    {
        return businessInfoMapper.deleteBusinessInfoById(businessId);
    }
} 